package com.ykq.controller;

import com.ykq.pojo.Menu;
import com.ykq.pojo.User;
import com.ykq.service.MenuService;
import com.ykq.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @program: vue_axios_ssm
 * @description:
 * @author: 闫克起2
 * @create: 2023-05-18 11:46
 **/
@Controller
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @RequestMapping("/getLeftMenu")
    @ResponseBody
    public Result getLeftMenu(HttpSession session){
        User user = (User) session.getAttribute("user");
        Integer id = user.getId();
        List<Menu> menus = menuService.selectByUserid(id);
        return new Result(200,"查询左侧菜单成功",menus);
    }
}
